package com.bit.web;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class UDPDictServer extends UDPEchoServer{
    Map<String,String> dic = new HashMap<>();
    public UDPDictServer(int port) throws SocketException {
        super(port);

        dic.put("hello","你好");
        dic.put("fuck","艹");
        dic.put("cat","猫");
    }

    @Override
    public String process(String request) {
        return dic.getOrDefault(request,"超出范围");
    }

    public static void main(String[] args) throws IOException {
        UDPDictServer server = new UDPDictServer(9090);
        server.start();
    }
}
